<?php
	include("scripts/connection.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="Content-Script-Type" content="text/javascript" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen, projection, tv" />
<!--[if lte IE 6]><link rel="stylesheet" type="text/css" href="css/style-ie.css" media="screen, projection, tv" /><![endif]-->
<link rel="stylesheet" href="css/style-print.css" type="text/css" media="print" />

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

<script type="text/javascript">
function getFaculty()
{
	var e = document.getElementById('faculty');
	
	var optionArray = ["engineering|ENGINEERING", "law|LAW", "philology|PHILOLOGY", "economic|ECONOMIC"];
	
	for(var option in optionArray)
	{
		var pair = optionArray[option].split('|');
		var newOption = document.createElement("option");
		newOption.value = pair[0];
		newOption.innerHTML = pair[1];
		e.options.add(newOption);
	}
			
}
function getGroup()
{
	var e1 = document.getElementById('faculty');
	var e2 = document.getElementById('group');

	
	e2.innerHTML="";
	
	
	if(e1.value == "engineering")
	{
		var optionArray = ["a_03|A_03", "b_03|B_03", "c_03|C_03", "d_03|D_03"];
	}
	else if(e1.value == "law")
	{
		var optionArray = ["1l_03|1L_03", "2l_03|2L_03", "3l_03|3L_03", "4l_03|4L_03"];
	}
	else if(e1.value == "philology")
	{
		var optionArray = ["1p_03|1P_03", "2p_03|2P_03", "3p_03|3P_03", "4p_03|4P_03"];
	}
 	else if(e1.value == "economic")
	{
		var optionArray = ["1e_03|1E_03", "2e_03|2E_03", "3e_03|3E_03", "4e_03|4E_03"];
	}
	
	for(var option in optionArray)
	{
		var pair = optionArray[option].split('|');
		var newOption = document.createElement("option");
		newOption.value = pair[0];
		newOption.innerHTML = pair[1];
		e2.options.add(newOption);
	}
}
function check()
{
	var n = document.getElementById("name").value;
	var s = document.getElementById("surname").value;
	var f = document.getElementById("faculty").value;
	var g = document.getElementById("group").value;
	var l = document.getElementById("login").value;
	var p = document.getElementById("password").value;
	var p2 = document.getElementById("password2").value;
		
	if(n && s && f && g && l && p && p2)
	{
		document.forms["form"].submit();
	}	
}
</script>

<title>SDU</title>
</head>

<body onload="getFaculty()">

<div id="wrapper">
		<?php
			include("header.php");
		?>

   <div id="content-box-left">
				<div id="content-box-left-in">
					<div class="paging" title="" align='center'>
						<div class="box">
						
				<div id="box-in">
						<div class="article">
							<h2 align='center'>Registration</h2><br>	
									<form action="scripts/register.php" method="post" name="form">
										<table align="center" cellpadding="10" cellspacing="10">
											
											<tr>
												<td>name :</td><td><input type="name" name="name" id="name"></td>
											</tr>
											<tr>
								                <td>surname :</td><td><input type="surname" name="surname" id="surname"></td>
											</tr>
											<tr>
												<td>faculty :</td><td><select id="faculty" name="faculty" onchange="getGroup()"><option value="">Select</option></select></td>
											</tr>
											<tr>
												<td>group :</td><td><select id="group" name="group"></select></td>
											</tr>
											<tr>
												<td>login :</td><td><input type="login" name="login" id="login"></td>
											</tr>
											<tr>
                                                <td>password :</td><td><input type="password" name="password" id="password"></td>
                                            </tr> 
                                            <tr>
                                                 <td> repeat password :</td><td><input type="password" name="password2" id="password2"></td>
                                            </tr>   
											<tr>
												<td>
												</td>
												<td><input type="button" onclick="check()" value="OK"/></td>
											</tr>
											
										</table>
									</form>
								</div>
							</div>
						</div>
						</div>
					</div>	
					
			</div>
						
				</div>
	
</body>
</html>